package data;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;



public class ImageComponent extends Component{
    /**
	 * 
	 */
	private static final long serialVersionUID = -8635398811269637571L;
	BufferedImage img;

    public ImageComponent() {
		try {
			File input = new File(FilePath.SPLASH_IMAGE);
			img = ImageIO.read(input);
		} catch (IOException e) {
			e.printStackTrace();
		}	
    }
    
    public void paint(Graphics g) {
        g.drawImage(img, 0, 0, null);
    }


    public Dimension getPreferredSize() {
        if (img == null) {
             return new Dimension(100,100);
        } else {
           return new Dimension(img.getWidth(null), img.getHeight(null));
       }
    }
}
